﻿using SanJ.FreeCare.ParticiPants;
using SanJ.FreeCare.TypeFramework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Services;

namespace SanJ.FreeCare.Conditions
{
    public class ConditionManager : DomainService
    {
        private IConditionResponstiry responstiry;
        public ConditionManager(IConditionResponstiry IConditionResponstiry)
        {
            this.responstiry = IConditionResponstiry;
        }

        /// <summary>
        /// 创建
        /// </summary>
        /// <returns></returns>
        private async Task<Condition> CreateAsync(string clinicalStatusCode, string verificationStatusCode, string[] category, string severity, string code, string[] bodySite, string subjectId, string encounterId, DateTime onsetDateTime, string onsetAge,
            DateTime abatementDateTime, DateTime recordedDate, ParticiPant[] particiPant, Stage[] stage, string[] evidenceCodes, string note
            )
        {
            Condition condition = new Condition(clinicalStatusCode, verificationStatusCode, category, severity, code, bodySite, subjectId, encounterId, onsetDateTime, onsetAge, abatementDateTime, recordedDate, particiPant, stage, evidenceCodes, note);
            return await responstiry.InsertAsync(condition);
        }

        /// <summary>
        /// 更新
        /// </summary>
        /// <returns></returns>
        private async Task<Condition> UpdateAsync(string clinicalStatusCode, string verificationStatusCode, string[] category, string severity, string code, string[] bodySite, string subjectId, string encounterId, DateTime onsetDateTime, string onsetAge,
            DateTime abatementDateTime, DateTime recordedDate, ParticiPant[] particiPant, Stage[] stage, string[] evidenceCodes, string note
            )
        {
            Condition condition = new Condition(clinicalStatusCode, verificationStatusCode, category, severity, code, bodySite, subjectId, encounterId, onsetDateTime, onsetAge, abatementDateTime, recordedDate, particiPant, stage, evidenceCodes, note);
            return await responstiry.UpdateAsync(condition);
        }
    }
}
